package de.ret_world.openrpgstudio.editor.script;

import org.luaj.vm2.LuaTable;
import org.luaj.vm2.LuaValue;

/**
 * This interface describes an Object used in Scripts in the Game Engine. You need to implement some functions for creating your object directly into
 * a LuaTable or into a Lua-Script-String.
 *
 * @author Emu
 */
public interface ScriptObject {
    
    /**
     * This should be used directly after creating a new instance of this class. Use this method to create an Object from a LuaValue.
     *
     * @param val the LuaValue representing the new Object.
     */
    public void create(LuaValue val);

    /**
     * This method creates a LuaTable of this Object, that can be used in the "create()" method to create en exact copy of this Object.
     * @return the created LuaTable.
     */
    public LuaTable toLua();

    /**
     * This method creates an Lua-Script-String which, when parsed in the ScriptParser, creates a LuaValue that can be used in the "create()" method to create en exact copy of this Object.
     * @return the created Lua-Script-String.
     */
    public String toScript();
}
